<?php
/**
 * Created by PhpStorm.
 * User: leixiaotian
 * Date: 2020/9/22
 * Time: 11:17
 */

namespace App\Model;

use Illuminate\Support\Facades\DB;

class Couple extends BaseModel
{
    protected $connection = 'api';
    protected $table = "coupling";
    protected $fields = ['id', 'user_id as userId', 'cp_user_id as cpUserId',
        'intimate', 'level', 'autograph', 'ring_id as ringId',
        'ring_record_id as ringRecordId','keepsake_id as keepsakeId','create_time as createTime',
        'create_timestamp as createTimestamp',
        'update_time as updateTime',
        'is_deleted as isDeleted'
    ];

    public function __construct()
    {
        $this->tablePrefix = env('DB_PREFIX');
    }

    public function getList($ids = []) {
        $rows = DB::connection($this->connection)
            ->table($this->table)
            ->whereIn('user_id', $ids)
            ->select($this->fields)
            ->get();
        return $this->objToArray($rows);
    }
}